package day13_Io.demo01_file;

import java.io.File;
import java.io.IOException;

public class 剪切 {
    public static void main(String[] args) throws IOException {
        File file = new File("E:\\csw\\Demo\\a");
        File newfile = new File("E:\\csw\\Demo\\copy");
        show(file,newfile);
    }
    public static void show(File file,File newfile) throws IOException {
        File[] files = file.listFiles();
        for (File file1 : files) {
            if (file1.isFile()){
                File file2 = new File(newfile, file1.getName());
                file2.createNewFile();
                file1.delete();
            }else{
                File file2 = new File(newfile, file1.getName());
                file2.mkdirs();
                show(file1,file2);
            }
        }
        file.delete();
    }
}
